Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lag Non-contained Issues (Piston Driven Clocks) #499

Open
FriendlyGamer opened this issue Dec 13, 2019 · 13 comments
Open

Lag Non-contained Issues (Piston Driven Clocks) #499

FriendlyGamer opened this issue Dec 13, 2019 · 13 comments
Labels
Milestone

Comments

@FriendlyGamer
Copy link

Basically if a player decides to make a mesecon "clock" with piston, mese, mesecon "wires", powerplant (or similar setup) then they can make them operate so insanely fast that it hit the CPU core's at a few % for as long one is operating.

At the rate that was noticed it would take about 50 of these simple ish devices to draw a sustained 100% CPU usage (one entire CPU core).

A few possible ideas in my mind that possibly that either the mesecon coding is not optimized or it could be that such situations where there no "definitive" speed defined (like say for the blinky plant) the devices simply will go as fast as they will without any "restraints" in place or not "enough" thus passing that to the CPU to "worry about".

Are either of my assumptions correct? If not what can I as an administrator do practically speaking at scale to cop with lagness from such?

@SmallJoker
Copy link
Member

Are you talking about server CPU usage or client?
Also consider enabling the profiler (see minetest.conf.example or main menu settings) to gather some execution time results. If mesecons takes much time to execute a step, then it's probably a mesecons issue, otherwise it's likely that Minetest needs time to prepare the new mapblocks for rendering.

@FriendlyGamer
Copy link
Author

Are you talking about server CPU usage or client?
Also consider enabling the profiler (see minetest.conf.example or main menu settings) to gather some execution time results. If mesecons takes much time to execute a step, then it's probably a mesecons issue, otherwise it's likely that Minetest needs time to prepare the new mapblocks for rendering.

Thank you very much for your reply. I did mean the server's CPU usage and since I wasn't sure on how to use the profiler to trace down lag sources... We did it when both the device was off and then when it was on. With the same exact person in the same exact in game location. So the variation that the mapblock needed time to render should not have existed, since this was server sided we noticed and we did our best to limit variables as humanly possible.

@Desour
Copy link
Contributor

Desour commented Dec 14, 2019

Fast (with delay of one globalstep dtime) gate oscillations are forbidden by overheats. Pistons are indeed lacking this.
Btw. here's a screenshot (from another issue, but shows the subject):
https://github.com/minetest-mods/mesecons/issues/405#issuecomment-419751937

@FriendlyGamer
Copy link
Author

FriendlyGamer commented Dec 14, 2019

Fast (with delay of one globalstep dtime) gate oscillations are forbidden by overheats. Pistons are indeed lacking this.
Btw. here's a screenshot (from another issue, but shows the subject):
https://github.com/minetest-mods/mesecons/issues/405#issuecomment-419751937

So what your saying everything but pistons are "throttled" by "overheat"? If so could we implement that or something similar to prevent piston based lag machines from being as easily produce able in game? Because as I said it would only takes about 50 of these to max out a core according to our testing of a single clock similar to the one above.

@Desour
Copy link
Contributor

Desour commented Dec 15, 2019

So what your saying everything but pistons are "throttled" by "overheat"?

Try connecting a not gate's output with its input. After a short time it will drop.
See also:

if mesecon.do_overheat(pos) then
minetest.remove_node(pos)
mesecon.receptor_off(pos, gate_get_output_rules(node))
minetest.add_item(pos, gate.drop)

If so could we implement that or something similar to prevent piston based lag machines from being as easily produce able in game?

The best thing to do is probably to use mesecons.do_overheat (and overheat group) for pistons and swap them with an overheated version. The overheated piston should then not react to mesecons and after a node timer that was started when the overheated piston is constructed runs out, the overheated piston should be swapped to a normal piston again and updated to the current mesecons signal state.

Feel free to make a PR! ; ) (But note that this might be a bit more difficult than described.)

@FriendlyGamer
Copy link
Author

So what your saying everything but pistons are "throttled" by "overheat"?

Try connecting a not gate's output with its input. After a short time it will drop.
See also:

if mesecon.do_overheat(pos) then
minetest.remove_node(pos)
mesecon.receptor_off(pos, gate_get_output_rules(node))
minetest.add_item(pos, gate.drop)

If so could we implement that or something similar to prevent piston based lag machines from being as easily produce able in game?

The best thing to do is probably to use mesecons.do_overheat (and overheat group) for pistons and swap them with an overheated version. The overheated piston should then not react to mesecons and after a node timer that was started when the overheated piston is constructed runs out, the overheated piston should be swapped to a normal piston again and updated to the current mesecons signal state.

Feel free to make a PR! ; ) (But note that this might be a bit more difficult than described.)

Thanks for the information but please do keep in mind that I meant to highlight and bring up this situation on my server so people can refer to this issue and help reach a solution for the mod itself.

Which can then be applied to my and all other operating Minetest servers which are based on this mod. So hopefully someone can help us here to resolve the situation sooner or later.

@numberZero
Copy link
Contributor

See also #406

@numberZero
Copy link
Contributor

I’d suggest limiting piston speed instead of overheating. Sadly that’s a breaking change, there may be machines relying on instant action (I don’t remember ever seeing that actually... except of my own machines =)

@FriendlyGamer
Copy link
Author

I’d suggest limiting piston speed instead of overheating. Sadly that’s a breaking change, there may be machines relying on instant action (I don’t remember ever seeing that actually... except of my own machines =)

Exactly and indeed better than letting people easily exploit servers' CPU resources I am not right? Even Minecraft's Redstone is throttled to allow per redstone tick which in Minecraft was every 2 in game ticks which is equal to 10ms.

@numberZero numberZero added the bug label Jun 27, 2020
@numberZero numberZero added this to the Mesecons 1.3 milestone Jun 27, 2020
@numberZero
Copy link
Contributor

I think that can be configurable with possibility to keep the current behavior.

@BuckarooBanzay
Copy link
Member

Your issue may be solved by third-party mods that provide management of the cpu-resources consumed by this mod,
for example: mesecons_debug

@FriendlyGamer
Copy link
Author

Your issue may be solved by third-party mods that provide management of the cpu-resources consumed by this mod,
for example: mesecons_debug

Hey thanks for the suggestion however, checking this mod awhile ago and even now it doesn't appear to have a clear understanding of the hard coded limitation in place per mapblock and currently lack any configurations by this mod.

@numberZero
Copy link
Contributor

See PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants